Working with Sequence Grabber Outputs
In order to allow sequence grabber components to capture to more than one data reference at a time, QuickTime 2.0 introduced the concept of a sequence grabber output. A
sequence grabber output
ties a sequence grabber channel to a specified data reference for the output of captured data.
If you are capturing to a single movie file, you can continue to use the
SGSetDataOutput
function (or the new
SGSetDataRef
function) to specify the sequence grabber's destination. However, if you want to capture movie data into several different files or data references, you must use sequence grabber outputs to do so. Even if you are using outputs, you must still use the
SGSetDataOutput
function or the
SGSetDataRef
function to identify where the sequence grabber should create the movie resource.
You are responsible for creating outputs, assigning them to sequence grabber channels, and disposing of them when you are done. Sequence grabber components provide a number of functions for managing outputs:
- The SGNewOutput function creates a new output.
- The SGDisposeOutput function disposes of an output.
- The SGSetOutputFlags function configures the output.
- The SGSetChannelOutput function assigns an output to a channel.
- The SGGetDataOutputStorageSpaceRemaining function determines how much space is left in the output.
SGNewOutput
The SGNewOutput function creates a new sequence grabber output.
pascal ComponentResult SGNewOutput (
SeqGrabComponent s,
Handle dataRef,
OSType dataRefType,
long whereFlags,
SGOutput *sgOut);
-
s
-
Specifies the component instance that identifies your connection to the sequence grabber component. You obtain this value from the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
dataRef
-
Contains a handle to the information that identifies the destination container.
-
dataRefType
-
Specifies the type of data reference. If the data reference is an alias, you must set the parameter to
rAliasType
(
'alis'
), indicating that the reference is an alias.
-
whereFlags
-
Contains flags that control the record operation. You must set either the
seqGrabToDisk
flag or the
seqGrabToMemory
flag to 1 (set unused flags to 0):
-
seqGrabToDisk
-
Instructs the sequence grabber component to write the recorded data to a QuickTime movie in the container specified by the
dataRef
parameter. If you set this flag to 1, the sequence grabber writes the data to the container as the data is recorded. Set this flag to 0 if you set the
seqGrabToMemory
flag to 1. Only one of these two flags may be set to 1.
-
seqGrabToMemory
-
Instructs the sequence grabber component to store the recorded data in memory until the recording process is complete. The sequence grabber then writes the recorded data to the container specified by the
dataRef
parameter. This technique provides better performance than recording directly to the container, but limits the amount of data you can record. Set this flag to 1 to record to memory. Set this flag to 0 if you set the
seqGrabToDisk
flag to 1 Only one of these two flags may be set to 1.
-
seqGrabDontUseTempMemory
-
Prevents the sequence grabber component from using temporary memory during the record operation. By default, the sequence grabber component and its channel components use as much temporary memory as necessary to perform the record operation. Set this flag to 1 to prevent the sequence grabber component and its channel components from using temporary memory.
-
seqGrabAppendToFile
-
Directs the sequence grabber component to add the recorded data to the data fork of the container specified by the
dataRef
parameter. By default, the sequence grabber component deletes the container and creates a new file containing one movie and the corresponding movie resource. Set this flag to 1 to cause the sequence grabber component to append the recorded data to the data fork of the container and create a new movie resource in that file.
-
seqGrabDontAddMovieResource
-
Prevents the sequence grabber component from adding the new movie resource to the container specified by the
dataRef
parameter. By default, the sequence grabber component creates a new movie resource and adds that resource to the container. Set this flag to 1 to prevent the sequence grabber component from adding the movie resource to the container. You are then responsible for adding the resource to a file, if you so desire.
-
seqGrabDontMakeMovie
-
Prevents the sequence grabber component from creating a movie. By default, the sequence grabber component creates a new movie resource and adds the captured data to that movie. If you set this flag to 1, the sequence grabber still calls your data function, but does not write any data to the movie file.
-
seqGrabDataProcIsInterruptSafe
-
Specifies that your data function is interrupt-safe, and may be called at interrupt time. This allows the sequence grabber component to present the captured data as soon as possible. Note that not all sequence grabber channel components may use this feature.
-
sgOut
-
Contains a pointer to a sequence grabber output. The sequence grabber component returns an output identifier. You can then use this identifier with other sequence grabber component functions.
DISCUSSION
The
SGNewOutput
function creates a new sequence grabber output. You specify the output's destination container using a data reference. Once you have created the sequence grabber output, you can use the
SGSetChannelOutput
function to assign the output to a sequence grabber channel.
RESULT CODES
paramErr
|
-50
|
Invalid parameter specified
|
SGDisposeOutput
The SGDisposeOutput function disposes of an existing output.
pascal ComponentResult SGDisposeOutput (
SeqGrabComponent s,
SGOutput sgOut);
-
s
-
Specifies the component instance that identifies your connection to the sequence grabber component. You obtain this value from the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
sgOut
-
Identifies the sequence grabber output for this operation. You obtain this identifier by calling the
SGNewOutput
function.
DISCUSSION
You use the
SGDisposeOutput
function to dispose of an existing output. If any sequence grabber channels are using this output, the sequence grabber component assigns them to an undefined output.
Note that you cannot dispose of an output when the sequence grabber component is in record mode.
RESULT CODES
cantDoThatInCurrentMode
|
-9402
|
Request invalid in current mode
|
SGSetChannelOutput
The SGSetChannelOutput function assigns an output to a channel.
pascal ComponentResult SGSetChannelOutput (
SeqGrabComponent s,
SGChannel c,
SGOutput sgOut);
-
s
-
Specifies the component instance that identifies your connection to the sequence grabber component. You obtain this value from the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
c
-
Identifies the channel for this operation by passing your connection identifier. You connect to a channel component by calling the
SGNewChannel
or
SGNewChannelFromComponent
functions.
-
sgOut
-
Identifies the sequence grabber output for this operation. You obtain this identifier by calling the
SGNewOutput
function.
DISCUSSION
You use the
SGSetChannelOutput
function to assign an output to a channel. Note that when you call the
SGSetDataRef
or
SGSetDataOutput
functions the sequence grabber component sets every channel to the specified file or container. If you want to use different outputs, you must use this function to assign the channels appropriately. One output may be assigned to one or more channels.
RESULT CODES
badSGChannel
|
-9406
|
Invalid channel specified
|
SGSetOutputFlags
The SGSetOutputFlags function configures an existing sequence grabber output.
pascal ComponentResult SGSetOutputFlags (
SeqGrabComponent s,
SGOutput sgOut,
long whereFlags);
-
s
-
Specifies the component instance that identifies your connection to the sequence grabber component. You obtain this value from the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
sgOut
-
Identifies the sequence grabber output for this operation. You obtain this identifier by calling the
SGNewOutput
function.
-
whereFlags
-
Contains flags that control the record operation. You must set either the
seqGrabToDisk
flag or the
seqGrabToMemory
flag to 1 (set unused flags to 0):
-
seqGrabToDisk
-
Instructs the sequence grabber component to write the recorded data to a QuickTime movie in the container specified by the
dataRef
parameter. If you set this flag to 1, the sequence grabber writes the data to the container as the data is recorded. Set this flag to 0 if you set the
seqGrabToMemory
flag to 1. Only one of these two flags may be set to 1.
-
seqGrabToMemory
-
Instructs the sequence grabber component to store the recorded data in memory until the recording process is complete. The sequence grabber then writes the recorded data to the container specified by the
dataRef
parameter. This technique provides better performance than recording directly to the container, but limits the amount of data you can record. Set this flag to 1 to record to memory. Set this flag to 0 if you set the
seqGrabToDisk
flag to 1. Only one of these two flags may be set to 1.
-
seqGrabDontUseTempMemory
-
Prevents the sequence grabber component from using temporary memory during the record operation. By default, the sequence grabber component and its channel components use as much temporary memory as necessary to perform the record operation. Set this flag to 1 to prevent the sequence grabber component and its channel components from using temporary memory.
-
seqGrabAppendToFile
-
Directs the sequence grabber component to add the recorded data to the data fork of the container specified by the
dataRef
parameter. By default, the sequence grabber component deletes the container and creates a new file containing one movie and the corresponding movie resource. Set this flag to 1 to cause the sequence grabber component to append the recorded data to the data fork of the container and create a new movie resource in that file.
-
seqGrabDontAddMovieResource
-
Prevents the sequence grabber component from adding the new movie resource to the container specified by the
dataRef
parameter. By default, the sequence grabber component creates a new movie resource and adds that resource to the container. Set this flag to 1 to prevent the sequence grabber component from adding the movie resource to the container. You are then responsible for adding the resource to a file, if you so desire.
-
seqGrabDontMakeMovie
-
Prevents the sequence grabber component from creating a movie. By default, the sequence grabber component creates a new movie resource and adds the captured data to that movie. If you set this flag to 1, the sequence grabber still calls your data function, but does not write any data to the movie file.
-
seqGrabDataProcIsInterruptSafe
-
Specifies that your data function is interrupt-safe, and may be called at interrupt time. This allows the sequence grabber component to present the captured data as soon as possible. Note that not all sequence grabber channel components may use this feature.
DISCUSSION
The
SGSetOutputFlags
function allows you to configure an existing sequence grabber output.
RESULT CODES
paramErr
|
-50
|
Invalid parameter specified
|
cantDoThatInCurrentMode
|
-9402
|
Request invalid in current mode
|
SGGetDataOutputStorageSpaceRemaining
The SGGetDataOutputStorageSpaceRemaining function returns the amount of space remaining in the data reference associated with an output.
pascal ComponentResult SGGetDataOutputStorageSpaceRemaining ( SeqGrabComponent s,
SGOutput sgOut,
unsigned long *space);
-
s
-
Specifies the component instance that identifies your connection to the sequence grabber component. You obtain this value from the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
sgOut
-
Identifies the sequence grabber output for this operation. You obtain this identifier by calling the
SGNewOutput
function.
-
space
-
Contains a pointer to an unsigned long. The sequence grabber component returns a value that indicates the number of bytes of space remaining in the data reference associated with the output.
DISCUSSION
The
SGGetDataOutputStorageSpaceRemaining
function allows you to determine the amount of space remaining in the data reference associated with an output. Use this function in place of the
SGGetStorageSpaceRemaining
function in cases where you are working with more than one output.
RESULT CODES
paramErr
|
-50
|
Invalid parameter specified
|
© 1997 Apple Computer, Inc.Previous | Chapter Top | Chapter Contents | Next